{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "8.写一个程序，能够交互式的计算球体的体积"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "tips:input(),$V = \\frac{4}{3}\\pi r^{3}$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "您好，我是乐学偶得计算机器人，请输入您想计算球体的半径：1\n",
      "经过我聪明的计算，这个球体的大小为： 4.188790205197241\n"
     ]
    }
   ],
   "source": [
    "r=int(input(\"您好，我是乐学偶得计算机器人，请输入您想计算球体的半径：\"))\n",
    "pi=3.141592653897931\n",
    "V=(4/3)*pi*r**3\n",
    "print(\"经过我聪明的计算，这个球体的大小为：\",V)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "float"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import math\n",
    "type(math.pi)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "您好，我是乐学偶得计算机器人，请输入您想计算球体的半径：1\n",
      "经过我聪明的计算，这个球体的大小为： 4.1887902047863905\n"
     ]
    }
   ],
   "source": [
    "r=int(input(\"您好，我是乐学偶得计算机器人，请输入您想计算球体的半径：\"))\n",
    "pi=math.pi\n",
    "V=(4/3)*pi*r**3\n",
    "print(\"经过我聪明的计算，这个球体的大小为：\",V)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
